package cn.uppower.wordaliy.widget;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.blankj.utilcode.util.BarUtils;
import com.gyf.barlibrary.ImmersionBar;

/**
 * Created by elitetyc on 2018/11/15.
 * Describe:
 */
public abstract class BaseActivity extends AppCompatActivity {

    public static Integer layoutResId;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        layoutResId = getLayoutResId();
        if (layoutResId != null) {
            setContentView(layoutResId);
        }
//        隐藏actionBar
        getSupportActionBar().hide();
        ImmersionBar.with(this)
                .fullScreen(true)
                .init();
//        if (this instanceof SplashActivity){
//
//        }
        BarUtils.setNavBarVisibility(this, false);
        init();
    }


    public abstract Integer getLayoutResId();

    /**
     * 对activity进行初始化
     */
    public abstract void init();


    @Override
    protected void onDestroy() {
        super.onDestroy();
        ImmersionBar.with(this).destroy();
    }
}
